home *** CD-ROM | disk | FTP | other *** search
- Path: erich.triumf.ca!bennett
- From: bennett@erich.triumf.ca (P.Bennett)
- Newsgroups: comp.lang.c
- Subject: Re: rand ?
- Date: 16 Mar 1996 10:31 PST
- Organization: TRIUMF: Tri-University Meson Facility
- Distribution: world
- Message-ID: <16MAR199610311834@erich.triumf.ca>
- References: <4idjt4$4du@itsop2.its.brooklyn.cuny.edu>
- NNTP-Posting-Host: erich.triumf.ca
- News-Software: VAX/VMS VNEWS 1.50
-
- In article <4idjt4$4du@itsop2.its.brooklyn.cuny.edu>, dzielins@its.brooklyn.cuny.edu (Daniel Zielinski) writes...
- >I need to generate random numbers between 0 and 51, I tried rand() with srand(i)
- >i changes constantly but the program never exits. looks like the random number
- >is always the same. any help would be apriciated... thanss
- >
-
- Since rand() and srand() are standard library functions that _do_ work when
- used as intended, a little sample of your use would be very helpful in
- diagnosing your problem.
-
- srand() is normally called _once_ only. Calling rand() reptetively will return
- a sequence of pseudo-random numbers between 0 and RAND_MAX (for MS-DOS, 0 to
- 32767).
-
- The faq (available by ftp from rtfm.mit.edu) has some suggestions on getting
- random numbers in a specific range.
-
-
- Peter Bennett VE7CEI | Vessels shall be deemed to be in sight
- Internet: bennett@triumf.ca | of one another only when one can be
- Packet: ve7cei@ve7kit.#vanc.bc.ca | observed visually from the other
- TRIUMF, Vancouver, B.C., Canada | ColRegs 3(k)
- GPS and NMEA info and programs: ftp://sundae.triumf.ca/pub/peter/index.html
- or: ftp://ftp-i2.informatik.rwth-aachen.de/pub/arnd/GPS/peter/index.html
-
-